home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
System Booster
/
System Booster.iso
/
Archives
/
Timing
/
EZCron.lha
/
EZCronGUI
< prev
next >
Wrap
Text File
|
1996-01-17
|
29KB
|
1,032 lines
/* EZCronGUI v1.6 by Jim Hines. ©1995 All Rights Reserved.
** Internet email me at <hines_j@wvlink.mpl.com>
** EZCronGUI is The Graphic User Interface for EZCron, ©1994-1995 Jim Hines.
** 12-13-95 Added Speech Function to test subrtn.
** 12-22-95 Added Purge Function.
** 12-24-95 Added multi-windowing on prefs window
** 12-31-95 Added multi-windowing cyclegads on time and date fields
** Changed the main gui interface window and moved the new config
** button to the edit screen. Removed the Quik Add button altogether.
** 01-05-96 Added Weekdays, Weekends and Quarterly support.
** Added full online help subroutine.
** 01-07-96 Added Default Event Variable Handling. Opens prefs file at beginning
** and rereads it with the 'addefault' command.
** added online help for def event button.
*/
LF= '0a'x
options results
if ~show("L","rexxsupport.library") then
call addlib("rexxsupport.library", 0, -30)
if ~show('L','rexxreqtools.library') then
call addlib("rexxreqtools.library", 0, -30, 0)
if ~showlist( 'p', 'VAREXX' ) then do
address command 'run >nil: varexx'
call delay(25)
waitforport
waitforport
end
address VAREXX
call openport("MAINWINPORT")
load 'EZCron:EZC.gui MAINWINPORT'
host = result
address value host
show project0
startup:
if showlist('P', 'ACRON_REXX') then do
settext text '"EZCron is Currently Running"'
end
if ~showlist('P', 'ACRON_REXX') then do
settext text '"EZCron is NOT Currently Running"'
end
/* ===== MAIN LOOP =======*/
mainloop:
do forever /* Wait for the user to close the window */
date = Date(USA)
settext datewin date
setlist eventlist clear /* CLEAR THE LISTVIEW WINDOW */
/* ===== READ AND PARSE THE CONFIG FILE ===== */
config = 's:cron.config' /* Name of file for reading events from */
event. = 0
if ~open(cronfile, config,'READ') then do
exit 20
end
errors = 0
do until eof(cronfile)
/* Grab the line, parse the event and ignore the comments */
linein = readln(cronfile)
parse var linein line '#'
next = event.0 + 1
parse var line event.next.command event.next.pargs1 event.next.pargs2,
event.next.pargs3 event.next.pargs4 event.next.time event.next.date,
event.next.sfx event.next.txt
event.next.date = translate(event.next.date, 'abcdefghijklmnopqrstuvwxyz',,
'ABCDEFGHIJKLMNOPQRSTUVWXYZ')
/* THE ABOVE TRANSLATES THE DATE TO LOWERCASE IF NOT NUMERIC */
event.next.time = translate(event.next.time, 'abcdefghijklmnopqrstuvwxyz',,
'ABCDEFGHIJKLMNOPQRSTUVWXYZ')
/* THE ABOVE TRANSLATES THE TIME TO LOWERCASE IF NOT NUMERIC */
if line ~= '' then do /* This keeps the commented out lines from appearing */
setlist Eventlist event.next.command event.next.pargs1 event.next.pargs2 event.next.pargs3 event.next.pargs4 event.next.time event.next.date event.next.txt '************************'
end
select
when event.next.command = '' then iterate
when event.next.command = '' then do
iterate
end
otherwise event.0 = next
end
end /* end of: do until EOF */
call close(cronfile)
/* =====END OF PARSE SECTION == */
do forever /* THIS DO LOOP CONTROLS THE CLOCK AND CHECKS FOR A PACKET */
packet = getpkt( "MAINWINPORT" )
clock = time('N') /* THIS IS THE TIME WITH SECONDS IN 24HR */
clock2 = LEFT(clock,5) /* THIS GET RID OF THE SECONDS */
sec = right(clock, 2) /* Get Seconds */
settext time clock
call delay(48)
/* do forever /* THIS DO LOOP CONTROLS THE CLOCK AND CHECKS FOR A PACKET */
packet = getpkt( "MAINWINPORT" )
newtime = time(s) /* Thanks Andy! */
if oldtime ~= newtime then do
clock = time('N') /* THIS IS THE TIME WITH SECONDS IN 24HR */
clock2 = LEFT(clock,5) /* THIS GET RID OF THE SECONDS */
sec = right(clock, 2) /* Get Seconds */
settext time clock
end
oldtime = newtime
*/
if packet ~= '00000000'x then do /* This is not a null message */
class = getarg(packet) /* Get the information about the message */
type = word(class, 1)
msg = substr(class, 1,9)
call classes()
end
end
classes:
/* =====CLASS CLOSEWINDOW ===== */
if class = closewindow then do
settext text 'Exiting EZCron'
call exiting()
end
/* =====CLASS PAGEEDIT ===== */
if class = pageedit then call eventedit()
/* =====CLASS AC_TOGGLE ===== */
if class = AC_Toggle then do
if ~showlist('P', 'ACRON_REXX') then do
address command 'run >nil: rx >nil: EZCron start'
waitforport
settext text '"EZCron is now Running"'
call mainloop()
end
else
if showlist('P', 'ACRON_REXX') then do
address command 'run >nil: rx >nil: EZCron stop'
busy set /* Turn on busy pointer */
do until ~showlist('P', 'ACRON_REXX')
clock = time('N')
sec = right(clock, 2) /* Get Seconds */
sec2 = 59 - sec /* 59 (seconds) minus sec) */
settext text '"EZCron will exit in"' sec2 'seconds.'
settext time clock
call delay(48)
end
settext text '"EZCron is NOT Currently Running"'
end
busy /* Turn off Busy Pointer */
call mainloop()
end
end /* End of first big do forever loop */
/* ===== EDITEVENT SUBROUTINE ========= */
eventedit:
hide
show editwindow
set sortgad blankgad1 disable
eventparse:
address value host /* this is so the correct window's buttons work after closing other windows */
drop ev et ed arg1 arg2 arg3 arg4 sfx txt field /* this drops any variables that may be present */
do forever
setlist selectevent clear
config = 's:cron.config' /* Name of file for reading events from */
event. = 0
if ~open(cronfile, config,'READ') then do
exit 20
end
errors = 0
do until eof(cronfile)
linein = readln(cronfile)
parse var linein line '#'
next = event.0 + 1
parse var line event.next.command event.next.pargs1 event.next.pargs2,
event.next.pargs3 event.next.pargs4 event.next.time event.next.date,
event.next.sfx event.next.txt
event.next.date = translate(event.next.date, 'abcdefghijklmnopqrstuvwxyz',,
'ABCDEFGHIJKLMNOPQRSTUVWXYZ')
/* THE ABOVE TRANSLATES THE DATE TO LOWERCASE IF NOT NUMERIC */
event.next.time = translate(event.next.time, 'abcdefghijklmnopqrstuvwxyz',,
'ABCDEFGHIJKLMNOPQRSTUVWXYZ')
/* THE ABOVE TRANSLATES THE TIME TO LOWERCASE IF NOT NUMERIC */
event.next.txt = strip(event.next.txt) /* This Gets rid of the leading & trailing spaces in the LAST variable
If new fields are added, the variable must be changed to reflect this */
if line ~= '' then do /* This keeps the commented out lines from appearing */
setlist selectevent event.next.command
end
select
when event.next.command = '' then iterate
when event.next.command = '' then do
iterate
end
otherwise event.0 = next
end
end
call close(cronfile)
/* ===== END OF PARSE */
waitforpkt:
call waitpkt( "MAINWINPORT" ) /* Wait for a message from Varexx */
packet = getpkt( "MAINWINPORT" ) /* Get the message */
if packet ~= '00000000'x then do /* This is not a null message */
class = getarg(packet) /* Get the information about the message */
type = word(class, 1)
msg = substr(class, 12,100)
say 'Message Var = ' msg
say 'Class Var = ' class
say 'Type Var = ' type
/* ===== CLASS EXIT EDITOR ===== */
if class = end then do /* This is the exit button */
hide
show project0
call startup()
end
/* ===== CLASS QUIT PROGRAM ===== */
if class = closewindow then call exiting()
/* ===== CLASS MAINHELP CHECK ===== */
if class = 'MAINHELP FALSE' then call mainhelp()
/* ===== CLASS PREFSGAD ===== */
if class = prefsgad then do
call openport(PREFSWINPORT)
spawn PREFSWINPORT
host2 = result
address value host2
show prefswindow
call prefs()
end
/* ===== CLASS EDIT ===== */
if class = EDIT then do
if ~exists('EZCron:prefs/txted.prefs') then address command 'ed s:cron.config'
if exists('EZCron:prefs/txted.prefs') then do
open(edconfig, 'EZCron:prefs/txted.prefs', 'r')
linein = readln(edconfig)
address command linein 's:cron.config'
close(edconfig)
end
end
/* ===== CLASS TEST EVENT ===== */
if class = testevent then do
if exists('EZCron:prefs/sfx.prefs') then do
open(sfxconfig, 'EZCron:prefs/sfx.prefs', 'r')
sfxplayer = readln(sfxconfig)
close(sfxconfig)
end
read event
ev = RESULT
read arg1
arg1 = RESULT
if arg1 = '-' then arg1 = ''
read arg2
arg2 = RESULT
if arg2 = '-' then arg2 = ''
read arg3
arg3 = RESULT
if arg3 = '-' then arg3 = ''
read arg4
arg4 = RESULT
if arg4 = '-' then arg4 = ''
read sfx
fx = RESULT
if fx = '-' then fx = ''
read txtstr
tx = result
if ev ~= textreminder then do
address command 'run >nil: 'ev arg1 arg2 arg3 arg4
end
if fx ~= '' then do
address command 'run >nil:' sfxplayer fx
end
if ev = TEXTREMINDER then do
address command 'run >nil: rx >nil: ezcron:rexx/Reminder.rexx' tx
if showlist(h,SPEAK) then do
address command 'echo' tx '>speak:'
end
end
drop ev arg1 fx tx sfxplayer
end
/* ===== CLASS GETFILE ===== */
if class = getfile then do
clock = time('N')
clock2 = LEFT(clock,5)
filename = rtfilerequest(, , "Pick a File To Run",OK, "rt_reqpos = reqpos_centerscr")
settext event filename
settext event_time clock2
settext event_date Date(USA)
settext arg1 '-'
settext arg2 '-'
settext arg3 '-'
settext arg3 '-'
settext sfx '-'
settext txtstr '-'
end
/* ===== CLASS NEW CONFIG ===== */
if class = AC_New then do
if exists('EZCron:prefs/cprefs') then do
open(prefs, 'EZCron:prefs/cprefs', 'r')
defevent = readln(prefs)
close(prefs)
end
if ~exists('s:cron.config') then do
open(MkCfg, 's:cron.config',W)
writeln(MkCfg, defevent)
close(MkCfg)
end
else
call rtezrequest("A cron.config file already exists."||LF||"Do you wish to overwrite it?.", "_Yes|_No", , "rt_reqpos = reqpos_centerscr")
if rtresult == 1 then do
if exists('s:cron.config.old') then address command 'delete s:cron.config.old'
address command 'rename s:cron.config s:cron.config.old'
call delay(3)
open(MkCfg, 's:cron.config','w')
writeln(MkCfg, defevent)
close(MkCfg)
end
end
/* ===== CLASS REQUESTER GADS ===== */
if class = arg1gad then do
argname = rtfilerequest(, , "Pick a file argument",OK, "rt_reqpos = reqpos_centerscr")
if argname = '' then argname = '-'
settext arg1 argname
end
if class = arg2gad then do
argname = rtfilerequest(, , "Pick a file argument",OK, "rt_reqpos = reqpos_centerscr")
if argname = '' then argname = '-'
settext arg2 argname
end
if class = arg3gad then do
argname = rtfilerequest(, , "Pick a file argument",OK, "rt_reqpos = reqpos_centerscr")
if argname = '' then argname = '-'
settext arg3 argname
end
if class = arg4gad then do
argname = rtfilerequest(, , "Pick a file argument",OK, "rt_reqpos = reqpos_centerscr")
if argname = '' then argname = '-'
settext arg4 argname
end
if class = sfxgad then do
read sfx
sfxtxt = result
parse var sfxtxt device ':'
if device = '-' then device = 'sys'
argname = rtfilerequest(device':',, "Pick a soundfile",OK, "rt_reqpos = reqpos_centerscr")
if argname = '' then argname = '-'
settext sfx argname
end
if class = txtgad then do
read txtstr
txt = result
if txt = '-' then txt = ''
argname = rtgetstring(txt,'Enter Reminder String', 'Reminder Requester', ,'rt_reqpos = reqpos_centerscr')
if argname = '' then call eventparse()
clock = time('N')
clock2 = LEFT(clock,5)
settext txtstr argname
settext event TextReminder
settext event_time clock2
settext event_date Date(USA)
settext arg1 '-'
settext arg2 '-'
settext arg3 '-'
settext arg3 '-'
settext sfx '-'
drop txt
end
if class = datehelp then do
call rtezrequest( " DATE HELP" || LF ||,
" " || LF ||,
" These are possible date fields." || LF ||,
" " || LF ||,
" " || LF ||,
" 01/01/95 * Run event once." || LF ||,
" " || LF ||,
" Mon-Fri * Run event every " || LF ||,
" named day of week." || LF ||,
" " || LF ||,
" Daily * Run event every day." || LF ||,
" " || LF ||,
" Weekdays * Run event every" || LF ||,
" Monday-Friday only." || LF ||,
" " || LF ||,
" ", "More", ,)
call rtezrequest( " DATE HELP" || LF ||,
" " || LF ||,
" More possible date fields." || LF ||,
" " || LF ||,
" " || LF ||,
" Weekend * Run event every" || LF ||,
" Saturday & Sunday only." || LF ||,
" " || LF ||,
" Monthly-12 * Run event every month" || LF ||,
" on given date. The date" || LF ||,
" is specified AFTER the" || LF ||,
" hyphen." || LF ||,
" " || LF ||,
" Every_#_ddd * This could actually be" || LF ||,
" typed as Every_3_Wed." || LF ||,
" This example would" || LF ||,
" execute an event every" || LF ||,
" 3rd Wed. of the month." || LF ||,
" The '#' can be 1-5." || LF ||,
" The 'ddd' is a three" || LF ||,
" letter abbr. for day" || LF ||,
" of the week." || LF ||,
" ", "Okay", ,)
call eventparse()
end
if class = timehelp then do
call rtezrequest( " TIME HELP" || LF ||,
" " || LF ||,
" These are possible time fields." || LF ||,
" " || LF ||,
" " || LF ||,
" 14:40 * Run event at 2:40pm." || LF ||,
" " || LF ||,
" Minute * Run event once every" || LF ||,
" minute." || LF ||,
" " || LF ||,
" Hourly * Run event every hour" || LF ||,
" on the hour." || LF ||,
" " || LF ||,
" Quarterly * Run event every 15" || LF ||,
" minutes." || LF ||,
" ", "Okay", ,)
call eventparse()
end
if class = datefields then do
call openport(DATEWINPORT)
spawn DATEWINPORT
host3 = result
address value host3
show datewindow
call datefields()
end
if class = timefields then do
call openport(TIMEWINPORT)
spawn TIMEWINPORT
host4 = result
address value host4
show timewindow
call timefields()
end
/* ===== CLASS PURGE EVENT ===== */
if class = purgegad then do
address command 'copy s:cron.config s:cron.config.old'
address command 'delete s:cron.config'
open(dfile, 's:cron.config', 'W') /* create it again*/
close(dfile)
do i = 1 to event.0
say event.i.date
parse var event.i.date month '/' day '/' year
if day ~= '' & if year ~= '' then do
sortdate = '19'year''month''day
eventdate = date('c',sortdate,'s') /* number of days since..*/
currentdate = date(s) /* 19951221 */
sortcurrent = date('c', currentdate, 's') /* number of days since..*/
a = sortcurrent-eventdate
say 'a equals =' a
if a > 0 then event.i.command = delete /* this are the files you DONT want to write */
end
if event.i.command ~= delete then do
open(dfile, 's:cron.config', 'a')
writeln(dfile, event.i.command event.i.pargs1 event.i.pargs2,
event.i.pargs3 event.i.pargs4 event.i.time,
event.i.date event.i.sfx event.i.txt)
drop result
end
close(dfile)
drop total
end
end
/* ===== CLASS UPDATE (MODIFY) EVENT ===== */
if class = update then do
read event
ev = result
if ev = '' then call message('No Event Field.')
if ev = '' then call eventparse()
if ev = 'None Selected' then call message('No Event Field.')
if ev = 'None Selected' then call eventparse()
event.en.command = ''
event.en.time = ''
event.en.date = ''
event.en.pargs1 = ''
event.en.pargs2 = ''
event.en.pargs3 = ''
event.en.pargs4 = ''
event.en.sfx = ''
event.en.txt = ''
address command 'copy s:cron.config s:cron.config.old'
address command 'delete s:cron.config'
open(dfile, 's:cron.config', 'W') /* create it again*/
close(dfile)
read selectevent var h
open(dfile, 's:cron.config', 'a')
do n = 1 to h.count
if event.n.time = '' then h.n = delete
if h.n ~= delete then
writeln(dfile, h.n event.n.pargs1 event.n.pargs2,
event.n.pargs3 event.n.pargs4 event.n.time,
event.n.date event.n.sfx event.n.txt)
drop result
end
close(dfile)
read event
ev = result
if ev = '' then call message('No Event Field.')
if ev = '' then call eventparse()
if ev = 'None Selected' then call message('No Event Field.')
if ev = 'None Selected' then call eventparse()
read event_time
et = result
if et = '' then call message('No Time Field.')
read event_date
ed = result
if ed = '' then call message('No Date Field.')
read arg1
arg1 = result
if arg1 = '' then arg1 = '-'
read arg2
arg2 = result
if arg2 = '' then arg2 = '-'
read arg3
arg3 = result
if arg3 = '' then arg3 = '-'
read arg4
arg4 = result
if arg4 = '' then arg4 = '-'
read sfx
sfx = result
if sfx = '' then sfx = '-'
read txtstr
txt = result
if txt = '' then txt = '-'
open(dfile, 's:cron.config', 'a')
writeln(dfile, ev arg1 arg2 arg3 arg4 et ed sfx txt)
close(dfile)
drop ev et ed arg1 arg2 arg3 arg4 sfx txt
end
/* ===== CLASS ADDEVENT ===== */
if class = addevent then do
read event
ev = result
if ev = '' then call message('No Event Field.')
if ev = 'None Selected' then call message('No Event Field.')
read event_time
et = result
if et = '' then call message('No Time Field.')
read event_date
ed = result
if ed = '' then call message('No Date Field.')
read arg1
arg1 = result
if arg1 = '' then arg1 = '-'
read arg2
arg2 = result
if arg2 = '' then arg2 = '-'
read arg3
arg3 = result
if arg3 = '' then arg3 = '-'
read arg4
arg4 = result
if arg4 = '' then arg4 = '-'
read sfx
sfx = result
if sfx = '' then sfx = '-'
read txtstr
txt = result
if txt = '' then txt = '-'
if ev = '' then call eventparse()
if ev = 'None Selected' then call eventparse()
if et = '' then call eventparse()
if ed = '' then call eventparse()
open(dfile, 's:cron.config', 'a')
writeln(dfile, ev arg1 arg2 arg3 arg4 et ed sfx txt)
close(dfile)
drop ev et ed arg1 arg2 arg3 arg4 sfx txt
call eventparse()
end
/* ===== CLASS ADDEFAULT EVENT ===== */
if class = addefault then do
read event
ev = result
if ev = '' then call message('No Event Field.')
if ev = 'None Selected' then call message('No Event Field.')
read event_time
et = result
if et = '' then call message('No Time Field.')
read event_date
ed = result
if ed = '' then call message('No Date Field.')
read arg1
arg1 = result
if arg1 = '' then arg1 = '-'
read arg2
arg2 = result
if arg2 = '' then arg2 = '-'
read arg3
arg3 = result
if arg3 = '' then arg3 = '-'
read arg4
arg4 = result
if arg4 = '' then arg4 = '-'
read sfx
sfx = result
if sfx = '' then sfx = '-'
read txtstr
txt = result
if txt = '' then txt = '-'
if ev = '' then call eventparse()
if ev = 'None Selected' then call eventparse()
if et = '' then call eventparse()
if ed = '' then call eventparse()
address command 'delete ezcron:prefs/cprefs'
open(dfile, 'ezcron:prefs/cprefs', 'w')
writeln(dfile, ev arg1 arg2 arg3 arg4 et ed sfx txt)
close(dfile)
drop ev et ed arg1 arg2 arg3 arg4 sfx txt
call eventparse()
end
/* ===== SELECTEVENT ===== */
if msg ~= '' & type = 'SELECTEVENT' then do
settext event msg
read selectevent NUMBER
en = RESULT /* en is the event number */
say 'en = ' en
settext event_time event.en.time
settext event_date event.en.date
settext arg1 event.en.pargs1
settext arg2 event.en.pargs2
settext arg3 event.en.pargs3
settext arg4 event.en.pargs4
settext sfx event.en.sfx
settext txtstr event.en.txt
say 'event.en.sfx =' event.en.sfx
say 'event.en.txt =' event.en.txt
say 'event.0 = ' event.0
end
/* ===== CLASS DELETE EVENT ===== */
if class = delete_event then do
event.en.command = ''
event.en.time = ''
event.en.date = ''
event.en.pargs1 = ''
event.en.pargs2 = ''
event.en.pargs3 = ''
event.en.pargs4 = ''
event.en.sfx = ''
event.en.txt = ''
address command 'copy s:cron.config s:cron.config.old'
address command 'delete s:cron.config'
open(dfile, 's:cron.config', 'W') /* create it again*/
close(dfile)
read selectevent var h
open(dfile, 's:cron.config', 'a')
do n = 1 to h.count
if event.n.time = '' then h.n = delete
if h.n ~= delete then
writeln(dfile, h.n event.n.pargs1 event.n.pargs2,
event.n.pargs3 event.n.pargs4 event.n.time,
event.n.date event.n.sfx event.n.txt)
drop result
end
close(dfile)
settext event 'None Selected'
settext event_time 'NA'
settext event_date 'NA'
settext arg1 '-'
settext arg2 '-'
settext arg3 '-'
settext arg3 '-'
settext sfx '-'
settext txtstr '-'
call eventparse()
end /* Above routine end */
end /* rexx portcheck end */
end /* do forever main loop end */
exit /* end of program....subs follow */
/* ===== SUB-ROUTINES START HERE ==== */
/* ===== PREFERENCES ===== */
prefs:
set time_format date_format gadget42 disable
call waitpkt( "PREFSWINPORT" ) /* Wait for a message from Varexx */
packet = getpkt( "PREFSWINPORT" ) /* Get the message */
if packet ~= '00000000'x then do /* This is not a null message */
class = getarg(packet) /* Get the information about the message */
type = word(class, 1)
msg = substr(class, 12,100)
say 'class =' class
say 'msg =' msg
if class = 'CLOSEWINDOW PrefsWindow' then do /* This is strange */
hide
call eventparse()
end
if class = exitprefs then do
hide
call eventparse()
end
if class = texteditor then do
editor = rtfilerequest(, , "Pick a text editor",OK, "rt_reqpos = reqpos_centerscr")
if rtresult == 0 then call prefs() /*This get out of the edprefs function */
open(edconfig,'EZCron:prefs/txted.prefs', 'w')
writeln(edconfig, editor)
close(edconfig)
drop editor
end
if class = sfxplayer then do
player = rtfilerequest(, , "Pick a sound player",OK, "rt_reqpos = reqpos_centerscr")
if rtresult == 0 then call prefs() /*This get out of the edprefs function */
open(edconfig,'EZCron:prefs/sfx.prefs', 'w')
writeln(edconfig, player)
close(edconfig)
drop player
end
call prefs()
end
/* ===== DATE FIELD REQUESTER ===== */
datefields:
field = ''
do forever
call waitpkt( "DATEWINPORT" ) /* Wait for a message from Varexx */
packet = getpkt( "DATEWINPORT" ) /* Get the message */
if packet ~= '00000000'x then do /* This is not a null message */
class = getarg(packet) /* Get the information about the message */
type = word(class, 1)
msg = substr(class, 11,25)
if field = '' then field = date(usa)
say 'field before the if string is' field
if msg = '0' then field = Date(USA)
if msg = '1' then field = 'Daily'
if msg = '2' then field = 'Monthly-'right(date(S),2) /* Monthly-13 */
if msg = '3' then field = 'Sunday'
if msg = '4' then field = 'Monday'
if msg = '5' then field = 'Tuesday'
if msg = '6' then field = 'Wednesday'
if msg = '7' then field = 'Thursday'
if msg = '8' then field = 'Friday'
if msg = '9' then field = 'Saturday'
if msg = '10' then field = 'Sunday'
if msg = '11' then field = 'Weekdays'
if msg = '12' then field = 'Weekend'
if msg = '13' then field = 'Every_1_Mon'
if class = 'CLOSEWINDOW DateWindow' then do
hide
address value host
call eventparse()
end
if class = exitdate then do
hide
address value host
call eventparse()
end
if class = okay then do
hide
address value host
settext event_date field
call eventparse()
end
end
end
/* ===== TIME FIELD REQUESTER ===== */
timefields:
field = ''
do forever
call waitpkt( "TIMEWINPORT" ) /* Wait for a message from Varexx */
packet = getpkt( "TIMEWINPORT" ) /* Get the message */
if packet ~= '00000000'x then do /* This is not a null message */
class = getarg(packet) /* Get the information about the message */
type = word(class, 1)
msg = substr(class, 11,25)
if field = '' then field = LEFT(time('N'),5)
if msg = '0' then field = LEFT(time('N'),5)
if msg = '1' then field = 'Minute'
if msg = '2' then field = 'Hourly'
if msg = '3' then field = 'Quarterly'
if class = 'CLOSEWINDOW timewindow' then do
hide
address value host
call eventparse()
end
if class = exittime then do
hide
address value host
call eventparse()
end
if class = okay then do
hide
address value host
settext event_time field
call eventparse()
end
end
end
mainhelp:
do forever
call waitpkt( "MAINWINPORT" ) /* Wait for a message from Varexx */
packet = getpkt( "MAINWINPORT" ) /* Get the message */
if packet ~= '00000000'x then do /* This is not a null message */
class = getarg(packet) /* Get the information about the message */
type = word(class, 1)
msg = substr(class, 12,100)
say 'class =' class
say 'msg =' msg
if class = 'MAINHELP TRUE' then call eventparse()
if class = getfile then call helpmessage('Calls file requester.')
if class = timehelp then call helpmessage('Time field help gadget.')
if class = timefields then call helpmessage('Time fields cycle gadget.')
if class = datehelp then call helpmessage('Date field help.')
if class = datefields then call helpmessage('Date fields cycle gadget')
if class = arg1gad then call helpmessage('Calls requester for file arguments')
if class = arg2gad then call helpmessage('Calls requester for file arguments')
if class = arg3gad then call helpmessage('Calls requester for file arguments')
if class = arg4gad then call helpmessage('Calls requester for file arguments')
if class = sfxgad then call helpmessage('Selects a sound file.')
if class = txtgad then call helpmessage('Adds a text string.')
if class = addevent then
call rtezrequest("ADD AN EVENT TO THE LIST." || LF ||,
"You MUST fill in your fields" || LF ||,
"BEFORE pushing the ADD gadget." || LF ||,
" ", "OKay", ,)
if class = ac_new then call helpmessage('Creates a new s:cron.config file.')
if class = delete_event then call helpmessage('Removes event from the list.')
if class = edit then call helpmessage('Calls an external text editor.')
if class = update then
call rtezrequest("UPDATES THE SELECTED EVENT." || LF ||,
"Select the event you wish to modify." || LF ||,
"Make the modifications you wish." || LF ||,
"Click the Modif gadget." || LF ||,
" ", "OKay", ,)
if class = testevent then call helpmessage('Tests the selected event')
if class = purgegad then call helpmessage('Removes old, one time events.')
if class = prefsgad then call helpmessage('Calls up the preferences window.')
if class = end then call helpmessage('Exits editor window.')
if class = closewindow then call helpmessage('Quits EZCron.')
/* if class = addefault then call helpmessage('Saves selected event as default event.')*/
if class = addefault then
call rtezrequest("SAVES THE SELECTED (CURRENT)" || LF ||,
"EVENT AS THE DEFAULT EVENT." || LF ||,
" " || LF ||,
"Whenever you select the NEW" || LF ||,
"gadget, it always adds an event" || LF ||,
"to the newly created list. This" || LF ||,
"is the default event." || LF ||,
"This may be set to a past" || LF ||,
"date if you wish for nothing to" || LF ||,
"take place." || LF ||,
" ", "OKay", ,)
end
end
helpmessage: procedure
call rtezrequest( arg(1),'Okay!','EZCron Online Help','rtez_flags=ezreqf_centertext',)
return
message: procedure
call rtezrequest( arg(1),'Okay!','EZCron ERROR','rt_reqpos = reqpos_centerscr rtez_flags=ezreqf_centertext',)
return
/* ===== EXIT AND CLEAN UP ===== */
exiting:
address command 'run >nil: avail flush'
'hide unload' /* Hide the window and unload the gui file from memory */
call delay(15)
call closeport( "MAINWINPORT" ) /* Close the port */
address command 'run >nil: vxc'
exit